/**
 * Nuxt.js 配置文件
 */

module.exports = {
    router: {
        base: '/fed-e-part-module-7',
        linkActiveClass: 'active',
        // 自定义路由表规则
        // routes: 一个数组，路由配置表
        // resolve: 解析路由组件路径
        extendRoutes(routes, resolve) {
            // 这个routes参数就是个数组，这里面就是默认以文件路径配置的路由规则
            // 清除 Nuxt.js 基于 pages 目录默认生成的路由表规则
            routes.splice(0) //  清空当前数组
            // 添加自己的路由规则
            routes.push(...[{
                path: '/',
                component: resolve(__dirname, 'pages/layout/'),
                children: [{
                        name: 'home',
                        path: '',
                        component: resolve(__dirname, 'pages/home')
                    },
                    {
                        name: 'login',
                        path: '/login',
                        component: resolve(__dirname, 'pages/login/')
                    },
                    {
                        name: 'register',
                        path: '/register',
                        component: resolve(__dirname, 'pages/login/')
                    },
                    {
                        name: 'profile',
                        path: '/profile/:username',
                        component: resolve(__dirname, 'pages/profile/')
                    },
                    {
                        name: 'settings',
                        path: '/settings',
                        component: resolve(__dirname, 'pages/settings/')
                    },
                    {
                        name: 'editor',
                        path: '/editor',
                        component: resolve(__dirname, 'pages/editor/')
                    },
                    {
                        name: 'article',
                        path: '/article/:slug',
                        component: resolve(__dirname, 'pages/article/')
                    }
                ]
            }])
        }
    },

    css: [
        '~static/index.css'
      ],

    build: {
        paraller: true,
        publicPath: 'fed-e-part-module-7/_nuxt/'
    },
    // 注册插件
    plugins: [
        '~/plugins/request.js',
        '~/plugins/dayjs.js'
    ]
}